package com.guigu.springcloud.common;

import lombok.Data;

import java.util.HashMap;

@Data
public class CommonResult {

    private Integer code;
    private String message;
    private HashMap<String, Object> data;

    private CommonResult() {
    }

    public static CommonResult voData(Integer code, String message, Object object) {
        CommonResult result = new CommonResult();
        result.setCode(code);
        result.setMessage(message);
        if (object != null) {
            HashMap<String, Object> data = new HashMap<>();
            data.put("item", object);
            result.setData(data);
        }
        return result;
    }
}
